//
//  PKCommunityCommentTableViewCell.m
//  PianKe
//
//  Created by lanou on 16/1/4.
//  Copyright © 2016年 KFC. All rights reserved.
//

#import "PKCommunityCommentTableViewCell.h"

@implementation PKCommunityCommentTableViewCell





- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _headerImage = [[UIImageView alloc] initWithFrame:CGRectMake(15*kWidthBase, 15*kHeightBase, 60*kWidthBase, 60*kHeightBase)];
        [self.contentView addSubview:_headerImage];
        _headerImage.layer.cornerRadius = 30;
        _headerImage.layer.masksToBounds = YES;
        
        _unameLabel = [[UILabel alloc] initWithFrame:CGRectMake(_headerImage.right + 10*kWidthBase, _headerImage.top + 5*kHeightBase, 200*kWidthBase, 25*kHeightBase)];
        [self.contentView addSubview:_unameLabel];
        
        _addtime_fLabel = [[UILabel alloc] initWithFrame:CGRectMake(_unameLabel.left, _unameLabel.bottom + 5*kHeightBase, 200*kWidthBase, 20*kHeightBase)];
        _addtime_fLabel.font = [UIFont systemFontOfSize:10];
        [self.contentView addSubview:_addtime_fLabel];
        
        _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(_headerImage.left, _headerImage.bottom + 15*kHeightBase, 300*kWidthBase, 40*kHeightBase)];
        _contentLabel.numberOfLines = 0;
        _contentLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_contentLabel];
        
        
        _likenum = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - 80*kWidthBase, _unameLabel.top, 70*kWidthBase, 30*kHeightBase)];
        _likenum.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_likenum];
        
        
    }
    return self;
}



- (void)setModel:(PKCommunityWebModel *)model
{
    
    _model = model;
    
    NSDictionary *userInfoDic = model.userinfo;
    
    [_headerImage sd_setImageWithURL:[NSURL URLWithString:userInfoDic[@"icon"]] placeholderImage:nil];
    
    _unameLabel.text = userInfoDic[@"uname"];
    
    _addtime_fLabel.text = [NSString stringWithFormat:@"%@",model.addtime_f];
    
    _contentLabel.text = _model.content;
    _likenum.text = [NSString stringWithFormat:@"%@", _model.likenum];
     
    
}














- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
